# Makefile.am - src/ directory Makefile for miredo

# ***********************************************************************
# *  Copyright © 2004-2009 Rémi Denis-Courmont.                         *
# *  This program is free software; you can redistribute and/or modify  *
# *  it under the terms of the GNU General Public License as published  *
# *  by the Free Software Foundation; version 2 of the license, or (at  *
# *  your option) any later version.                                    *
# *                                                                     *
# *  This program is distributed in the hope that it will be useful,    *
# *  but WITHOUT ANY WARRANTY; without even the implied warranty of     *
# *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               *
# *  See the GNU General Public License for more details.               *
# *                                                                     *
# *  You should have received a copy of the GNU General Public License  *
# *  along with this program; if not, you can get it from:              *
# *  http://www.gnu.org/copyleft/gpl.html                               *
# ***********************************************************************

sbin_PROGRAMS = miredo miredo-server miredo-checkconf
pkglibexec_PROGRAMS =
noinst_LTLIBRARIES += libmiredo.la

libmiredo_la_DEPENDENCIES = libcompat.la
libmiredo_la_SOURCES = \
	src/miredo.c src/miredo.h \
	src/conf.c src/conf.h \
	src/main.c
libmiredo_la_LIBADD = $(LTLIBINTL) $(LIBCAP) libcompat.la
libmiredo_la_LDFLAGS = -no-undefined -static
#libmiredo_la_LDFLAGS = -no-undefined -release @VERSION@
# libmiredo is dynamic only to reduce executables size (all the code is
# reused at least three times); stable API is not quite an objective
# right now (<miredo.h> and <conf.h> are not installed by the way).
# That is why we use -release at the moment.

# miredo
miredo_SOURCES = src/relayd.c
miredo_LDADD = libtun6.la libteredo.la libmiredo.la \
		$(LIBRT) $(LIBINTL)

# privproc
miredo_privproc_SOURCES = src/privproc.c src/privproc.h
miredo_privproc_LDADD = libteredo.la $(LIBCAP)
if TEREDO_CLIENT
pkglibexec_PROGRAMS += miredo-privproc
TESTS += miredo-checkconf
endif

# miredo-server
miredo_server_SOURCES = src/serverd.c
miredo_server_LDADD = libteredo-server.la libmiredo.la $(LIBINTL)

# miredo-checkconf
miredo_checkconf_SOURCES = src/checkconf.c
miredo_checkconf_LDADD = libmiredo.la $(LIBINTL)

install-exec-local:
	$(install_sh) -d "$(DESTDIR)$(localstatedir)/run"

# SVN version
#$(srcdir)/svnversion.stamp:
#	{ \
#		echo -n 'const char *const svn_version = "' ; \
#		LANG=C svnversion -n "$(top_srcdir)" 2>/dev/null || \
#		echo -n exported ; \
#		echo '";' ; \
#	} > $(srcdir)/svnversion.stamp
#	if ! diff svnversion.stamp svnversion.c 2>/dev/null; then \
#		cat $(srcdir)/svnversion.stamp > $(srcdir)/svnversion.c ; \
#	fi
#
#.PHONY: $(srcdir)/svnversion.stamp

